/**
 * 订单接口
 * 
 * @author 杨斌
 * @since 2019-05-20
 */
import common from './common'
import store from './store'

var ApiList = {};

//API 接口

/**
 * 订单列表
 */

ApiList.getOrderList = function (uid, p, status, okCb, failCb) {
  var p = {
    uid,
    p
  }
  if (status != 0) {
    p['status'] = status
  }
  common.Api('/user_center/order_list', p, okCb, failCb)
}


/**
 * 购买水票
 */

ApiList.placeOrder = function (uid, product_id, number, okCb, failCb) {
  var p = {
    uid,
    product_id,
    number
  }
  common.Api('/order/placeOrder', p, okCb, failCb)
}


/**
 * 缴纳押金
 */

ApiList.placeOrderForYa = function (uid, address_id, okCb, failCb) {
  var p = {
    uid,
    address_id,
  }
  common.Api('/order/placeOrderForYa', p, okCb, failCb)
}


/**
 * 使用水票买水
 */

ApiList.useTicket = function (address_id, uid, product_id, delivery_time, zhan_id, number, okCb, failCb) {
  var p = {
    address_id,
    uid,
    product_id,
    delivery_time,
    zhan_id,
    number
  }
  common.Api('/order/useTicket', p, okCb, failCb)
}

/**
 * 退还水桶
 */

ApiList.returnBucket = function (uid, zhan_id, address_id, okCb, failCb) {
  var p = {
    uid,
    zhan_id,
    address_id,
  }
  common.Api('/order/returnBucket', p, okCb, failCb)
}

/**
 * 订单详情
 */

ApiList.orderDetail = function (id, okCb, failCb) {
  var p = {
    id,
  }
  common.Api('/user_center/order_detail', p, okCb, failCb)
}

/**
 * 删除订单
 */

ApiList.orderDel = function (id, okCb, failCb) {
  var p = {
    id,
  }
  common.Api('/user_center/order_del', p, okCb, failCb)
}




export default ApiList;
